package com.zx.flow.api.sdk.v1;


import com.zx.flow.api.execute.model.FlowContext;
import com.zx.flow.api.execute.model.FlowNode;
import com.zx.flow.api.execute.request.FlowParamAction;
import com.zx.flow.api.execute.request.FlowParamCancel;
import com.zx.flow.api.execute.request.FlowParamCommunicate;
import com.zx.flow.api.execute.request.FlowParamCommunicateAnswer;
import com.zx.flow.api.execute.request.FlowParamCreate;
import com.zx.flow.api.execute.request.FlowParamSave;
import com.zx.flow.api.execute.request.FlowParamSkip;
import com.zx.flow.api.execute.request.FlowParamStart;
import com.zx.flow.api.execute.request.FlowParamTransfer;
import com.zx.flow.api.execute.request.query.QueryFlowParam;
import com.zx.flow.api.execute.request.query.QueryNodeParam;
import com.zx.flow.api.execute.request.query.QueryNodesParam;
import com.zx.flow.api.execute.response.Response;
import java.util.List;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class FlowV1Sdk extends AbstractFlowSdk {

    private static final String URL_STAFFIX = "/flow/v1";

    public FlowV1Sdk(FlowSecretInfo secret, FlowSdkProfile profile) {
        super(secret, profile);
    }

    @Override
    public Response<FlowContext> getFlow(QueryFlowParam param) {
        return this.post(param, URL_STAFFIX + "/get/flow", Response.class);
    }

    @Override
    public Response<List<FlowNode>> getNodes(QueryNodesParam param) {
        return this.post(param, URL_STAFFIX + "/get/node", Response.class);
    }

    @Override
    public Response<FlowNode> getNode(QueryNodeParam param) {
        return this.post(param, URL_STAFFIX + "/get/nodes", Response.class);
    }

    @Override
    public Response<FlowContext> create(FlowParamCreate param) {
        return this.post(param, URL_STAFFIX + "/create", Response.class);
    }

    @Override
    public Response<FlowContext> save(FlowParamSave param) {
        return this.post(param, URL_STAFFIX + "/save", Response.class);
    }

    @Override
    public Response<FlowContext> start(FlowParamStart param) {
        return this.post(param, URL_STAFFIX + "/start", Response.class);
    }

    @Override
    public Response<FlowContext> action(FlowParamAction param) {
        return this.post(param, URL_STAFFIX + "/action", Response.class);
    }

    @Override
    public Response<FlowContext> transfer(FlowParamTransfer param) {
        return this.post(param, URL_STAFFIX + "/transfer", Response.class);
    }

    @Override
    public Response<FlowContext> communicate(FlowParamCommunicate param) {
        return this.post(param, URL_STAFFIX + "/communicate", Response.class);
    }

    @Override
    public Response<FlowContext> communicateAnswer(FlowParamCommunicateAnswer param) {
        return this.post(param, URL_STAFFIX + "/communicateAnswer", Response.class);
    }

    @Override
    public Response<FlowContext> cancel(FlowParamCancel param) {
        return this.post(param, URL_STAFFIX + "/cancel", Response.class);
    }

    @Override
    public Response<FlowContext> skip(FlowParamSkip param) {
        return this.post(param, URL_STAFFIX + "/skip", Response.class);
    }


}